<div>
    <div class="m-subheader">
        <div class="row align-items-center">
            <div class="mr-auto col-auto">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    <span>{{"Suppliers" | localize}}</span>
                </h3>
                <span class="m-section__sub">
                    {{"SuppliersHeaderInfo" | localize}}
                </span>
            </div>
            <div class="col text-right mt-3 mt-md-0">
                <!-- <div class="btn-group dropdown mr-2" dropdown>
                    <button dropdownToggle class="dropdown-toggle btn btn-outline-success">
                        <i class="far fa-file-excel"></i><span class="caret"></span> {{"ExcelOperations" | localize}}
                    </button>
                    <ul class="dropdown-menu dropdown-menu-right dropdown-excel-operations" *dropdownMenu>
                        <li>
                            <a href="javascript:;" (click)="exportToExcel()">
                                <i class="fa fa-download"></i>
                                {{'ExportToExcel' | localize}}
                            </a>
                        </li>

                        <li>
                            <a href="javascript:;" *ngIf="isGranted('Pages.Administration.Users.Create')"
                                class="no-padding">
                                <span>
                                    <p-fileUpload customUpload="true" name="ExcelFileUpload" #ExcelFileUpload
                                        maxFileSize="10000000" auto="auto" accept=".csv,.xls,.xlsx"
                                        (uploadHandler)="uploadExcel($event)" (onError)="onUploadExcelError()"
                                        chooseLabel="{{'ImportFromExcel' | localize}}">
                                    </p-fileUpload>
                                </span>
                            </a>
                        </li>
                        <li class="dropdown-divider"></li>
                        <li>
                            <span class="dropdown-item-text text-muted" href="#">
                                <small
                                    [innerHTML]="l('ImportToExcelSampleFileDownloadInfo', '<a href=/assets/sampleFiles/ImportUsersSampleFile.xlsx>' + l('ClickHere') + '</a>')"></small>
                            </span>
                        </li>

                    </ul>
                </div> -->
                <button (click)="createSupplier()" *ngIf="isGranted('Pages.Suppliers.Create')"
                    class="btn btn-primary"><i class="fa fa-plus"></i> 新增供方</button>
            </div>
        </div>
    </div>
    <div class="m-content">
        <div class="m-portlet m-portlet--mobile" style="margin: 0;">
            <div class="m-portlet__body" style="height: 724px;">
                <form class="horizontal-form" autocomplete="off">
                    <div class="m-form m-form--label-align-right">
                        <div class="row align-items-center m--margin-bottom-10">
                            <div class="col-xl-12" style="padding: 0;">
                                <div class="form-group m-form__group align-items-center">
                                    <div class="input-group">
                                        <input [(ngModel)]="filterText" name="filterText" autoFocus
                                            class="form-control m-input" [placeholder]="l('SearchWithThreeDot')"
                                            type="text">
                                        <span class="input-group-btn">
                                            <button (click)="getSuppliers()" class="btn btn-primary" type="submit"><i
                                                    class="flaticon-search-1"
                                                    [attr.aria-label]="l('Search')"></i></button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="row margin-bottom-10" *ngIf="advancedFiltersAreShown">
                            <div class="col-sm-12 text-right">
                                <button class="btn btn-metal" (click)="getSuppliers()"><i class="fa fa-sync"></i>
                                    刷新 </button>
                            </div>
                        </div>
                        <!-- <div class="row margin-bottom-10">
                            <div class="col-sm-12">
                                <span class="clickable-item text-muted" *ngIf="!advancedFiltersAreShown"
                                    (click)="advancedFiltersAreShown=!advancedFiltersAreShown"><i
                                        class="fa fa-angle-down"></i> 显示高级过滤</span>
                                <span class="clickable-item text-muted" *ngIf="advancedFiltersAreShown"
                                    (click)="advancedFiltersAreShown=!advancedFiltersAreShown"><i
                                        class="fa fa-angle-up"></i> 隐藏高级过滤</span>
                            </div>
                        </div> -->
                    </div>
                </form>

                <div class="row align-items-center">
                    <!--<Primeng-TurboTable-Start>-->
                    <div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
                        <p-table #dataTable (onLazyLoad)="getSuppliers($event)" [value]="primengTableHelper.records"
                            rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false" [lazy]="true"
                            [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                            [resizableColumns]="primengTableHelper.resizableColumns">
                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width: 130px"
                                        [hidden]="!isGrantedAny('Pages.Administration.Users.Impersonation', 'Pages.Administration.Users.Edit', 'Pages.Administration.Users.ChangePermissions', 'Pages.Administration.Users.Delete')">
                                        {{'Actions' | localize}}</th>
                                    <th style="width: 100px">
                                        序号
                                    </th>
                                    <th style="width: 230px">
                                        供应商名称
                                    </th>
                                    <th style="width: 150px">
                                        公司属性
                                    </th>
                                    <th style="width: 230px">
                                        联系地址
                                    </th>
                                    <th style="width: 150px">
                                        联系电话
                                    </th>
                                    <th style="width: 250px">
                                        产品范围
                                    </th>
                                    <th style="width: 200px">
                                        质量管理体系标准
                                    </th>
                                    <th style="width: 200px">
                                        隶属单位
                                    </th>
                                    <th style="width: 200px">
                                        生产许可、承制资格
                                    </th>
                                    <th style="width: 200px">
                                        合格供方分类
                                    </th>
                                    <th style="width: 200px">
                                        合格供方分级
                                    </th>
                                    <th style="width: 200px">
                                        涉及军方
                                    </th>
                                    <th style="width: 200px">
                                        保密资质
                                    </th>
                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-record="$implicit" let-ri='rowIndex'>
                                <tr>
                                    <td style="width: 130px"
                                        [hidden]="!isGrantedAny('Pages.Administration.Users.Impersonation', 'Pages.Administration.Users.Edit', 'Pages.Administration.Users.ChangePermissions', 'Pages.Administration.Users.Delete')">
                                        <div class="btn-group dropdown" dropdown container="body">
                                            <button dropdownToggle class="dropdown-toggle btn btn-sm btn-primary">
                                                <i class="fa fa-cog"></i><span class="caret"></span>
                                                {{"Actions" | localize}}
                                            </button>
                                            <ul class="dropdown-menu" *dropdownMenu>
                                                <!-- <li>
                                                    <a href="javascript:;"
                                                        *ngIf="('Pages.Tasks.Impersonation' | permission) && record.id !== appSession.userId"
                                                        (click)="_impersonationService.impersonate(record.id, appSession.tenantId)">{{'LoginAsThisUser' | localize}}</a>
                                                </li> -->
                                                <li>
                                                    <a href="javascript:;" *ngIf="'Pages.Suppliers.Edit' | permission"
                                                        (click)="createOrEditSupplierModal.show(record.id)">{{'Edit' | localize}}</a>
                                                </li>
                                                <li>
                                                    <a href="javascript:;" *ngIf="'Pages.Suppliers.Delete' | permission"
                                                        (click)="deleteSupplier(record)">{{'Delete' | localize}}</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                    <th style="width: 100px">
                                        {{ri+1}}
                                    </th>
                                    <td style="width: 230px">
                                        {{record.displayName}}
                                    </td>
                                    <td style="width: 150px">
                                        {{record.companyAttribute}}
                                    </td>
                                    <td style="width: 230px">
                                        {{record.address}}
                                    </td>
                                    <td style="width: 150px">
                                        {{record.phone}}
                                    </td>
                                    <td style="width: 250px">
                                        {{record.productRange}}
                                    </td>
                                    <td style="width: 200px">
                                        {{record.isoStandard}}
                                    </td>
                                    <td style="width: 200px">
                                        {{record.subordinateUnit }}
                                    </td>
                                    <td style="width: 200px">
                                        {{record.qualification}}
                                    </td>
                                    <td style="width: 200px">
                                        {{record.supplierClass}}
                                    </td>
                                    <td style="width: 200px">
                                        {{record.supplierLevel}}
                                    </td>
                                    <td style="width: 200px">
                                        <span *ngIf="record.secret==1"
                                            class="label m-badge m-badge--success m-badge--wide" data-toggle="tooltip"
                                            title="是" data-placement="top">
                                            是
                                        </span>
                                        <span *ngIf="record.secret==0"
                                            class="label m-badge m-badge--metal m-badge--wide" data-toggle="tooltip"
                                            title="否" data-placement="top">
                                            否
                                        </span>
                                    </td>
                                    <td style="width: 200px">
                                        {{record.secretLevel}}
                                    </td>
                                </tr>
                            </ng-template>
                        </p-table>
                        <div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
                            {{'NoData' | localize}}
                        </div>
                        <div class="primeng-paging-container">
                            <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                (onPageChange)="getSuppliers($event)"
                                [totalRecords]="primengTableHelper.totalRecordsCount"
                                [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">

                            </p-paginator>
                            <span class="total-records-count">
                                {{'TotalRecordsCount' | localize:primengTableHelper.totalRecordsCount}}
                            </span>
                        </div>
                    </div>
                    <!--<Primeng-TurboTable-End>-->
                </div>
            </div>
        </div>
    </div>

    <createOrEditSupplierModal #createOrEditSupplierModal (modalSave)="getSuppliers()"></createOrEditSupplierModal>

</div>